/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package de.hsmannheim.pepa.patientenportal.apanwep.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import de.hsmannheim.pepa.patientenportal.apanwep.model.objects;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * The cache model class for representing objects in entity cache.
 *
 * @author Cedric Nana
 * @see objects
 * @generated
 */
public class objectsCacheModel implements CacheModel<objects>, Externalizable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(13);

		sb.append("{objectID=");
		sb.append(objectID);
		sb.append(", objectname=");
		sb.append(objectname);
		sb.append(", object_ID=");
		sb.append(object_ID);
		sb.append(", objecttypecode=");
		sb.append(objecttypecode);
		sb.append(", objecttypecoderole=");
		sb.append(objecttypecoderole);
		sb.append(", objectidtypecode_id=");
		sb.append(objectidtypecode_id);
		sb.append("}");

		return sb.toString();
	}

	@Override
	public objects toEntityModel() {
		objectsImpl objectsImpl = new objectsImpl();

		objectsImpl.setObjectID(objectID);

		if (objectname == null) {
			objectsImpl.setObjectname(StringPool.BLANK);
		}
		else {
			objectsImpl.setObjectname(objectname);
		}

		if (object_ID == null) {
			objectsImpl.setObject_ID(StringPool.BLANK);
		}
		else {
			objectsImpl.setObject_ID(object_ID);
		}

		objectsImpl.setObjecttypecode(objecttypecode);
		objectsImpl.setObjecttypecoderole(objecttypecoderole);
		objectsImpl.setObjectidtypecode_id(objectidtypecode_id);

		objectsImpl.resetOriginalValues();

		return objectsImpl;
	}

	@Override
	public void readExternal(ObjectInput objectInput) throws IOException {
		objectID = objectInput.readLong();
		objectname = objectInput.readUTF();
		object_ID = objectInput.readUTF();
		objecttypecode = objectInput.readLong();
		objecttypecoderole = objectInput.readLong();
		objectidtypecode_id = objectInput.readLong();
	}

	@Override
	public void writeExternal(ObjectOutput objectOutput)
		throws IOException {
		objectOutput.writeLong(objectID);

		if (objectname == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(objectname);
		}

		if (object_ID == null) {
			objectOutput.writeUTF(StringPool.BLANK);
		}
		else {
			objectOutput.writeUTF(object_ID);
		}

		objectOutput.writeLong(objecttypecode);
		objectOutput.writeLong(objecttypecoderole);
		objectOutput.writeLong(objectidtypecode_id);
	}

	public long objectID;
	public String objectname;
	public String object_ID;
	public long objecttypecode;
	public long objecttypecoderole;
	public long objectidtypecode_id;
}